#ifndef DBSERVER_H
#define DBSERVER_H


#include "spipe.h"
#include "pipe.h"
#include "dbclient.h"

#define SRVR_PORT   1929

class DBServer;

extern DBServer *g_dbserver;

typedef pthread_mutex_t mutex;

class DBServer
{
        DBServer();
        virtual ~DBServer();
    public:

        static DBServer* startServer();
        void ProcessQuee();     /// erase nono-active client from vector


    protected:

        static void onError(SPipe *spipe, i32 err_code);
        static void onAccept(SPipe *spipe, i32 nothing);


        mutex mx_cli;

        SPipe ssocket;
        vector<DBClient*> clients;


};

#endif // DBSERVER_H
